package com.k2data.k2app.domain.po;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author lidong9144@163.com 17-3-16.
 */
@Data
@Table(name = "template_monitor_point")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TMonitorPoint implements Serializable {

    @Transient
    private static final long serialVersionUID = 5968006199173451940L;

    @JsonIgnore
    @Id
    @GeneratedValue(generator = "JDBC")
    private Long id;
    @NotNull
    private String sensorName;
    @NotNull
    private String sensorType;
    @NotNull
    @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "NameEn must be letter, number or underscode.")
    private String nameEn;
    private Integer state;
    @JsonIgnore
    private LocalDateTime createTime;
    @JsonIgnore
    private LocalDateTime updateTime;

    @Transient
    @JsonIgnore
    private Long rid;
    @Transient
    @JsonIgnore
    private String deviceName;
    @Transient
    @JsonIgnore
    private Integer channelId;

    // 关联表
    @JsonIgnore
    @Transient
    private List<TRDeviceMonitorPoint> rs;
    @JsonIgnore
    @Transient
    private List<TMonitorVariable> monitorVariables;

}
